<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <input type="text">
  <div></div>
  <script>
    let input = document.querySelector('input')
    input.oninput = function (e) {
      let val = input.value
      let xhr = new XMLHttpRequest()
      xhr.open('get', `https://apis.tianapi.com/charconvert/index?key=1abddedd769e196b38ba149d49817d13&text=${val}`)
      xhr.send()
      xhr.onreadystatechange = function () {
        if (xhr.readyState === 4 && xhr.status === 200) {
          let inp = JSON.parse(xhr.responseText)
          console.log(inp.result.outtext);
        }
      }
    }
  </script>
</body>

</html>